#include "iostream"
using namespace std;
long long my_mod(long a,long n,long mod){
    if(n==0)
        return 1;
    long x=my_mod(a,n/2,mod);
    long ans=x*x%mod;
    if(n%2==1)
        ans=ans*a%mod;
    return ans;
};
int main(){
    long  num,temp=0,jg=0;
    int mod;
    cin>>num>>mod;
    for (long i = 2; i <= num; ++i) {
        temp+=i*(i-1)%mod;
        cout<<temp<<" : "<<i*(i-1)%mod<<endl;
    }
    jg=temp%mod;
    cout<<jg<<endl;

    cout<<"   "<<10%11;
    return 0;
};
